public class Test {
    public static void main(String[] args) {
        int n=1000;
        //System.out.println(sum(n));
        //print(n);
        int ret = fun2(n);
        System.out.println(ret);
    }

    public static int fun2(int n){
        if(n<10){
            return n;
        }
        return n%10+fun2(n/10);
    }

    public static void print(int n){
        if(n<10){
            System.out.print(n+" ");
            return;
        }
        print(n/10);
        System.out.print(n%10+" ");
    }
    public static int sum(int n){
        if(n==1){
            return 1;
        }
        return n+sum(n-1);
    }
    public static void main2(String[] args) {
        int n=5;
        int ret = fun(n);

        System.out.println(ret);
    }
    public static int fun(int n){
        if(n==1){
            return 1;
        }else{
            return n*fun(n-1);
        }
    }

    public static void main1(String[] args) {
        int x=10;
        int y=20;

        int ret=fun1(x,y);
        System.out.println(ret);
    }
    public static int fun1(int x,int y){
        return x+y;
    }
}
